home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1999 Spring / macformat-077.iso / Shareware Plus / Development / Akua Sweets 131 / Akua Sweets Examples / Finder / View As… < prev    next >
Encoding:
Text File  |  1999-03-04  |  981 b   |  39 lines  |  [TEXT/ToyS]

  1. property kasView : 0
  2.  
  3.  
  4. on run
  5.     ShowAlert("Drop 1 folder/disk on this Applet to preserve its View for future application.")
  6. end run
  7.  
  8.  
  9. on open fsObjs
  10.     if the number of items in fsObjs is 1 then
  11.         if AskUser("Do you wish to apply the current view to this item or save its view for future application?", ¬
  12.             {"Save", "Apply"}) is "Save" then
  13.             set kasView to (finder view setting of (basic info for (item 1 of fsObjs)))
  14.             return
  15.         end if
  16.     end if
  17.     
  18.     -- Get our icon
  19.     repeat with fsObj in fsObjs
  20.         set fsInfo to basic info for fsObj
  21.         set the finder view setting of fsInfo to kasView
  22.         set the catalog info of fsObj to fsInfo
  23.         tell application "Finder" to update fsObj
  24.     end repeat
  25. end open
  26.  
  27.  
  28. on ShowAlert(msgStr)
  29.     display dialog msgStr buttons {"Yo!"} ¬
  30.         default button 1 with icon stop
  31. end ShowAlert
  32.  
  33.  
  34. on AskUser(question, choices)
  35.     return button returned of ¬
  36.         (display dialog question buttons choices ¬
  37.             default button (number of items in choices) with icon note)
  38. end AskUser
  39.